package io.github.codelifeleno.jdbrelease.config;

import java.util.Objects;
import java.util.StringJoiner;

/**
 * 通 DBScriptConfig.xml
 * 用于被扫描的配置文件 配置主要影响被扫描的文件内容的解析过程
 */
public class DBScriptConfig {

    /**
     * 单行结束符配置
     */
    private StatementSeparators separator = new StatementSeparators();
    /**
     * 文件中的注释前坠语后缀
     */
    private Comments comments = new Comments();

    @Override
    public String toString() {
        return new StringJoiner(", ", DBScriptConfig.class.getSimpleName() + "[", "]")
                .add("separator=" + separator)
                .add("comments=" + comments)
                .toString();
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;

        DBScriptConfig that = (DBScriptConfig) o;
        return Objects.equals(getSeparator(), that.getSeparator()) && Objects.equals(getComments(), that.getComments());
    }

    @Override
    public int hashCode() {
        int result = Objects.hashCode(getSeparator());
        result = 31 * result + Objects.hashCode(getComments());
        return result;
    }

    public StatementSeparators getSeparator() {
        return separator;
    }

    public void setSeparator(StatementSeparators separator) {
        this.separator = separator;
    }

    public Comments getComments() {
        return comments;
    }

    public void setComments(Comments comments) {
        this.comments = comments;
    }

    public DBScriptConfig() {
    }

    public DBScriptConfig(StatementSeparators separator, Comments comments) {
        this.separator = separator;
        this.comments = comments;
    }
}
